CC:=gcc
# -g 开启gdb的debug调试（生成的二进制文件中包含调试信息）
# -O0 禁用优化（确保调试一致性）
# -Wall 显示所有警告
CFLAGS := -g -O0 -Wall

log := thirdpart/log/log.c thirdpart/log/log.h
json := thirdpart/cJSON/cJSON.c thirdpart/cJSON/cJSON.h
app_common := app/app_common.c app/app_common.h
app_message := app/app_message.c app/app_message.h
app_mqtt := app/app_mqtt.c app/app_mqtt.h
app_pool := app/app_pool.c app/app_pool.h
app_buffer := app/app_buffer.c app/app_buffer.h
log_test: test/log_test.c $(log)
	-gcc $^ -o $@ -I thirdpart
	-./$@
	-rm $@

app_message_test: test/app_message_test.c $(log) $(json) $(app_common) $(app_message)
	-gcc $^ -o $@ -I thirdpart
	-./$@
	-rm $@


json_test: test/cJSON_test.c $(log) $(json)
	-gcc $(CFLAGS) $^ -o $@ -I thirdpart
	-./$@
#	-rm $@


mqtt_test: test/mqtt_test.c
	-gcc $^ -o $@ -l paho-mqtt3c
	-./$@
	-rm $@
app_mqtt_test: test/test_app_mqtt.c $(app_mqtt) $(log)
	-gcc $^ -o $@ -l paho-mqtt3c -I thirdparty -I app
	-./$@
	-rm $@	
mq1:	test/app_mq_test.c
	-gcc $(CFLAGS) $^ -o $@ 
	-./$@
	-rm $@
app_pool: test/app_pool.c $(app_pool) $(log)
	-gcc $^ -o $@ -I thirdparty -I app
	-./$@
	-rm $@

app_buffer: test/test_buffer.c $(app_buffer) $(log)
	-gcc $^ -o $@ -I thirdparty -I app
	-./$@
	-rm $@